home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGNG_C
/
CSUBR.LZH
/
LTOA.C
< prev
next >
Wrap
Text File
|
1985-11-29
|
395b
|
19 lines
ltoa(n,s) /* convert n to characters in s */
char s[];
long n;
{
int i,sign;
if ((sign = n) < 0) /* record sign */
n = -n; /* make positive */
i = 0;
do { /* generate digits in reverse order */
s[i++] = n % 10 + '0'; /* get next digit */
} while ((n /= 10) > 0); /* delete it */
if (sign < 0)
s[i++] = '-';
s[i] = '\0';
reverse(s);
return s;
}